3.3.6 \(\int x^2 \cos ^2(x) \cot ^3(x) \, dx\) [206]

3.3.6.1 Optimal result
3.3.6.2 Mathematica [A] (verified)
3.3.6.3 Rubi [F]
3.3.6.4 Maple [A] (verified)
3.3.6.5 Fricas [B] (verification not implemented)
3.3.6.6 Sympy [F]
3.3.6.7 Maxima [B] (verification not implemented)
3.3.6.8 Giac [F]
3.3.6.9 Mupad [F(-1)]

3.3.6.1 Optimal result

Integrand size = 12, antiderivative size = 106 \[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=-\frac {3 x^2}{4}+\frac {2 i x^3}{3}-x \cot (x)-\frac {1}{2} x^2 \cot ^2(x)-2 x^2 \log \left (1-e^{2 i x}\right )+\log (\sin (x))+2 i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\operatorname {PolyLog}\left (3,e^{2 i x}\right )+\frac {1}{2} x \cos (x) \sin (x)-\frac {\sin ^2(x)}{4}+\frac {1}{2} x^2 \sin ^2(x) \]

output
-3/4*x^2+2/3*I*x^3-x*cot(x)-1/2*x^2*cot(x)^2-2*x^2*ln(1-exp(2*I*x))+ln(sin 
(x))+2*I*x*polylog(2,exp(2*I*x))-polylog(3,exp(2*I*x))+1/2*x*cos(x)*sin(x) 
-1/4*sin(x)^2+1/2*x^2*sin(x)^2
 
3.3.6.2 Mathematica [A] (verified)

Time = 0.42 (sec) , antiderivative size = 111, normalized size of antiderivative = 1.05 \[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=\frac {i \pi ^3}{12}-\frac {2 i x^3}{3}+\frac {1}{8} \cos (2 x)-\frac {1}{4} x^2 \cos (2 x)-x \cot (x)-\frac {1}{2} x^2 \csc ^2(x)-2 x^2 \log \left (1-e^{-2 i x}\right )+\log (\cos (x))+\log (\tan (x))-2 i x \operatorname {PolyLog}\left (2,e^{-2 i x}\right )-\operatorname {PolyLog}\left (3,e^{-2 i x}\right )+\frac {1}{4} x \sin (2 x) \]

input
Integrate[x^2*Cos[x]^2*Cot[x]^3,x]
 
output
(I/12)*Pi^3 - ((2*I)/3)*x^3 + Cos[2*x]/8 - (x^2*Cos[2*x])/4 - x*Cot[x] - ( 
x^2*Csc[x]^2)/2 - 2*x^2*Log[1 - E^((-2*I)*x)] + Log[Cos[x]] + Log[Tan[x]] 
- (2*I)*x*PolyLog[2, E^((-2*I)*x)] - PolyLog[3, E^((-2*I)*x)] + (x*Sin[2*x 
])/4
 
3.3.6.3 Rubi [F]

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int x^2 \cos ^2(x) \cot ^3(x) \, dx\)

\(\Big \downarrow \) 4908

\(\displaystyle \int x^2 \cot ^3(x)dx-\int x^2 \cos ^2(x) \cot (x)dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int -x^2 \tan \left (x+\frac {\pi }{2}\right )^3dx-\int x^2 \cos ^2(x) \cot (x)dx\)

\(\Big \downarrow \) 25

\(\displaystyle -\int x^2 \tan \left (x+\frac {\pi }{2}\right )^3dx-\int x^2 \cos ^2(x) \cot (x)dx\)

\(\Big \downarrow \) 4203

\(\displaystyle \int -x^2 \cot (x)dx-\int x^2 \cos ^2(x) \cot (x)dx+\int x \cot ^2(x)dx-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 25

\(\displaystyle -\int x^2 \cot (x)dx-\int x^2 \cos ^2(x) \cot (x)dx+\int x \cot ^2(x)dx-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 3042

\(\displaystyle -\int -x^2 \tan \left (x+\frac {\pi }{2}\right )dx-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 25

\(\displaystyle \int x^2 \tan \left (x+\frac {\pi }{2}\right )dx-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 4200

\(\displaystyle -2 i \int -\frac {e^{2 i x} x^2}{1-e^{2 i x}}dx-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx+\frac {i x^3}{3}-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 25

\(\displaystyle 2 i \int \frac {e^{2 i x} x^2}{1-e^{2 i x}}dx-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx+\frac {i x^3}{3}-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 2620

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \int x \log \left (1-e^{2 i x}\right )dx\right )-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx+\frac {i x^3}{3}-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 3011

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{2} i \int \operatorname {PolyLog}\left (2,e^{2 i x}\right )dx\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx+\frac {i x^3}{3}-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 2720

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx+\int x \tan \left (x+\frac {\pi }{2}\right )^2dx+\frac {i x^3}{3}-\frac {1}{2} x^2 \cot ^2(x)\)

\(\Big \downarrow \) 4203

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx-\int xdx-\int -\cot (x)dx+\frac {i x^3}{3}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)\)

\(\Big \downarrow \) 15

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx-\int -\cot (x)dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)\)

\(\Big \downarrow \) 25

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx+\int \cot (x)dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)\)

\(\Big \downarrow \) 3042

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx+\int -\tan \left (x+\frac {\pi }{2}\right )dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)\)

\(\Big \downarrow \) 25

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx-\int \tan \left (x+\frac {\pi }{2}\right )dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)\)

\(\Big \downarrow \) 3956

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cos ^2(x) \cot (x)dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)+\log (\sin (x))\)

\(\Big \downarrow \) 4908

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int x^2 \cot (x)dx+\int x^2 \cos (x) \sin (x)dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)+\log (\sin (x))\)

\(\Big \downarrow \) 3042

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-\int -x^2 \tan \left (x+\frac {\pi }{2}\right )dx+\int x^2 \cos (x) \sin (x)dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)+\log (\sin (x))\)

\(\Big \downarrow \) 25

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\int x^2 \tan \left (x+\frac {\pi }{2}\right )dx+\int x^2 \cos (x) \sin (x)dx+\frac {i x^3}{3}-\frac {x^2}{2}-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)+\log (\sin (x))\)

\(\Big \downarrow \) 3924

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\int x^2 \tan \left (x+\frac {\pi }{2}\right )dx-\int x \sin ^2(x)dx+\frac {i x^3}{3}-\frac {x^2}{2}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)+\log (\sin (x))\)

\(\Big \downarrow \) 3042

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\int x^2 \tan \left (x+\frac {\pi }{2}\right )dx-\int x \sin (x)^2dx+\frac {i x^3}{3}-\frac {x^2}{2}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-x \cot (x)+\log (\sin (x))\)

\(\Big \downarrow \) 3791

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\int x^2 \tan \left (x+\frac {\pi }{2}\right )dx-\frac {\int xdx}{2}+\frac {i x^3}{3}-\frac {x^2}{2}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 15

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\int x^2 \tan \left (x+\frac {\pi }{2}\right )dx+\frac {i x^3}{3}-\frac {3 x^2}{4}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 4200

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )-2 i \int -\frac {e^{2 i x} x^2}{1-e^{2 i x}}dx+\frac {2 i x^3}{3}-\frac {3 x^2}{4}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 25

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+2 i \int \frac {e^{2 i x} x^2}{1-e^{2 i x}}dx+\frac {2 i x^3}{3}-\frac {3 x^2}{4}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 2620

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \int x \log \left (1-e^{2 i x}\right )dx\right )+\frac {2 i x^3}{3}-\frac {3 x^2}{4}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 3011

\(\displaystyle 2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{2} i \int \operatorname {PolyLog}\left (2,e^{2 i x}\right )dx\right )\right )+2 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\frac {2 i x^3}{3}-\frac {3 x^2}{4}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

\(\Big \downarrow \) 2720

\(\displaystyle 4 i \left (\frac {1}{2} i x^2 \log \left (1-e^{2 i x}\right )-i \left (\frac {1}{2} i x \operatorname {PolyLog}\left (2,e^{2 i x}\right )-\frac {1}{4} \int e^{-2 i x} \operatorname {PolyLog}\left (2,e^{2 i x}\right )de^{2 i x}\right )\right )+\frac {2 i x^3}{3}-\frac {3 x^2}{4}+\frac {1}{2} x^2 \sin ^2(x)-\frac {1}{2} x^2 \cot ^2(x)-\frac {\sin ^2(x)}{4}-x \cot (x)+\log (\sin (x))+\frac {1}{2} x \sin (x) \cos (x)\)

input
Int[x^2*Cos[x]^2*Cot[x]^3,x]
 
output
$Aborted
 

3.3.6.3.1 Defintions of rubi rules used

rule 15
Int[(a_.)*(x_)^(m_.), x_Symbol] :> Simp[a*(x^(m + 1)/(m + 1)), x] /; FreeQ[ 
{a, m}, x] && NeQ[m, -1]
 

rule 25
Int[-(Fx_), x_Symbol] :> Simp[Identity[-1]   Int[Fx, x], x]
 

rule 2620
Int[(((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)*((c_.) + (d_.)*(x_))^(m_.))/ 
((a_) + (b_.)*((F_)^((g_.)*((e_.) + (f_.)*(x_))))^(n_.)), x_Symbol] :> Simp 
[((c + d*x)^m/(b*f*g*n*Log[F]))*Log[1 + b*((F^(g*(e + f*x)))^n/a)], x] - Si 
mp[d*(m/(b*f*g*n*Log[F]))   Int[(c + d*x)^(m - 1)*Log[1 + b*((F^(g*(e + f*x 
)))^n/a)], x], x] /; FreeQ[{F, a, b, c, d, e, f, g, n}, x] && IGtQ[m, 0]
 

rule 2720
Int[u_, x_Symbol] :> With[{v = FunctionOfExponential[u, x]}, Simp[v/D[v, x] 
   Subst[Int[FunctionOfExponentialFunction[u, x]/x, x], x, v], x]] /; Funct 
ionOfExponentialQ[u, x] &&  !MatchQ[u, (w_)*((a_.)*(v_)^(n_))^(m_) /; FreeQ 
[{a, m, n}, x] && IntegerQ[m*n]] &&  !MatchQ[u, E^((c_.)*((a_.) + (b_.)*x)) 
*(F_)[v_] /; FreeQ[{a, b, c}, x] && InverseFunctionQ[F[x]]]
 

rule 3011
Int[Log[1 + (e_.)*((F_)^((c_.)*((a_.) + (b_.)*(x_))))^(n_.)]*((f_.) + (g_.) 
*(x_))^(m_.), x_Symbol] :> Simp[(-(f + g*x)^m)*(PolyLog[2, (-e)*(F^(c*(a + 
b*x)))^n]/(b*c*n*Log[F])), x] + Simp[g*(m/(b*c*n*Log[F]))   Int[(f + g*x)^( 
m - 1)*PolyLog[2, (-e)*(F^(c*(a + b*x)))^n], x], x] /; FreeQ[{F, a, b, c, e 
, f, g, n}, x] && GtQ[m, 0]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3791
Int[((c_.) + (d_.)*(x_))*((b_.)*sin[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> 
 Simp[d*((b*Sin[e + f*x])^n/(f^2*n^2)), x] + (-Simp[b*(c + d*x)*Cos[e + f*x 
]*((b*Sin[e + f*x])^(n - 1)/(f*n)), x] + Simp[b^2*((n - 1)/n)   Int[(c + d* 
x)*(b*Sin[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n, 
 1]
 

rule 3924
Int[Cos[(a_.) + (b_.)*(x_)^(n_.)]*(x_)^(m_.)*Sin[(a_.) + (b_.)*(x_)^(n_.)]^ 
(p_.), x_Symbol] :> Simp[x^(m - n + 1)*(Sin[a + b*x^n]^(p + 1)/(b*n*(p + 1) 
)), x] - Simp[(m - n + 1)/(b*n*(p + 1))   Int[x^(m - n)*Sin[a + b*x^n]^(p + 
 1), x], x] /; FreeQ[{a, b, p}, x] && LtQ[0, n, m + 1] && NeQ[p, -1]
 

rule 3956
Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d 
*x], x]]/d, x] /; FreeQ[{c, d}, x]
 

rule 4200
Int[((c_.) + (d_.)*(x_))^(m_.)*tan[(e_.) + Pi*(k_.) + (f_.)*(x_)], x_Symbol 
] :> Simp[I*((c + d*x)^(m + 1)/(d*(m + 1))), x] - Simp[2*I   Int[(c + d*x)^ 
m*E^(2*I*k*Pi)*(E^(2*I*(e + f*x))/(1 + E^(2*I*k*Pi)*E^(2*I*(e + f*x)))), x] 
, x] /; FreeQ[{c, d, e, f}, x] && IntegerQ[4*k] && IGtQ[m, 0]
 

rule 4203
Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symb 
ol] :> Simp[b*(c + d*x)^m*((b*Tan[e + f*x])^(n - 1)/(f*(n - 1))), x] + (-Si 
mp[b*d*(m/(f*(n - 1)))   Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1), x] 
, x] - Simp[b^2   Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; Free 
Q[{b, c, d, e, f}, x] && GtQ[n, 1] && GtQ[m, 0]
 

rule 4908
Int[Cos[(a_.) + (b_.)*(x_)]^(n_.)*Cot[(a_.) + (b_.)*(x_)]^(p_.)*((c_.) + (d 
_.)*(x_))^(m_.), x_Symbol] :> -Int[(c + d*x)^m*Cos[a + b*x]^n*Cot[a + b*x]^ 
(p - 2), x] + Int[(c + d*x)^m*Cos[a + b*x]^(n - 2)*Cot[a + b*x]^p, x] /; Fr 
eeQ[{a, b, c, d, m}, x] && IGtQ[n, 0] && IGtQ[p, 0]
 
3.3.6.4 Maple [A] (verified)

Time = 4.30 (sec) , antiderivative size = 170, normalized size of antiderivative = 1.60

method result size
risch \(\frac {2 i x^{3}}{3}-\frac {\left (2 x^{2}+2 i x -1\right ) {\mathrm e}^{2 i x}}{16}-\frac {\left (2 x^{2}-2 i x -1\right ) {\mathrm e}^{-2 i x}}{16}+\frac {2 x \left ({\mathrm e}^{2 i x} x -i {\mathrm e}^{2 i x}+i\right )}{\left ({\mathrm e}^{2 i x}-1\right )^{2}}-2 \ln \left ({\mathrm e}^{i x}\right )+\ln \left ({\mathrm e}^{i x}+1\right )+\ln \left ({\mathrm e}^{i x}-1\right )-2 x^{2} \ln \left ({\mathrm e}^{i x}+1\right )+4 i x \operatorname {polylog}\left (2, -{\mathrm e}^{i x}\right )-4 \operatorname {polylog}\left (3, -{\mathrm e}^{i x}\right )-2 x^{2} \ln \left (1-{\mathrm e}^{i x}\right )+4 i x \operatorname {polylog}\left (2, {\mathrm e}^{i x}\right )-4 \operatorname {polylog}\left (3, {\mathrm e}^{i x}\right )\) \(170\)

input
int(x^2*cos(x)^2*cot(x)^3,x,method=_RETURNVERBOSE)
 
output
2/3*I*x^3-1/16*(2*I*x+2*x^2-1)*exp(2*I*x)-1/16*(-2*I*x+2*x^2-1)*exp(-2*I*x 
)+2*x*(exp(2*I*x)*x-I*exp(2*I*x)+I)/(exp(2*I*x)-1)^2-2*ln(exp(I*x))+ln(exp 
(I*x)+1)+ln(exp(I*x)-1)-2*x^2*ln(exp(I*x)+1)+4*I*x*polylog(2,-exp(I*x))-4* 
polylog(3,-exp(I*x))-2*x^2*ln(1-exp(I*x))+4*I*x*polylog(2,exp(I*x))-4*poly 
log(3,exp(I*x))
 
3.3.6.5 Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 370 vs. \(2 (80) = 160\).

Time = 0.30 (sec) , antiderivative size = 370, normalized size of antiderivative = 3.49 \[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=-\frac {2 \, {\left (2 \, x^{2} - 1\right )} \cos \left (x\right )^{4} - 3 \, {\left (2 \, x^{2} - 1\right )} \cos \left (x\right )^{2} - 2 \, x^{2} + 16 \, {\left (-i \, x \cos \left (x\right )^{2} + i \, x\right )} {\rm Li}_2\left (\cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 16 \, {\left (i \, x \cos \left (x\right )^{2} - i \, x\right )} {\rm Li}_2\left (\cos \left (x\right ) - i \, \sin \left (x\right )\right ) + 16 \, {\left (i \, x \cos \left (x\right )^{2} - i \, x\right )} {\rm Li}_2\left (-\cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 16 \, {\left (-i \, x \cos \left (x\right )^{2} + i \, x\right )} {\rm Li}_2\left (-\cos \left (x\right ) - i \, \sin \left (x\right )\right ) + 4 \, {\left ({\left (2 \, x^{2} - 1\right )} \cos \left (x\right )^{2} - 2 \, x^{2} + 1\right )} \log \left (\cos \left (x\right ) + i \, \sin \left (x\right ) + 1\right ) + 4 \, {\left ({\left (2 \, x^{2} - 1\right )} \cos \left (x\right )^{2} - 2 \, x^{2} + 1\right )} \log \left (\cos \left (x\right ) - i \, \sin \left (x\right ) + 1\right ) - 4 \, {\left (\cos \left (x\right )^{2} - 1\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2} i \, \sin \left (x\right ) + \frac {1}{2}\right ) - 4 \, {\left (\cos \left (x\right )^{2} - 1\right )} \log \left (-\frac {1}{2} \, \cos \left (x\right ) - \frac {1}{2} i \, \sin \left (x\right ) + \frac {1}{2}\right ) + 8 \, {\left (x^{2} \cos \left (x\right )^{2} - x^{2}\right )} \log \left (-\cos \left (x\right ) + i \, \sin \left (x\right ) + 1\right ) + 8 \, {\left (x^{2} \cos \left (x\right )^{2} - x^{2}\right )} \log \left (-\cos \left (x\right ) - i \, \sin \left (x\right ) + 1\right ) + 16 \, {\left (\cos \left (x\right )^{2} - 1\right )} {\rm polylog}\left (3, \cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 16 \, {\left (\cos \left (x\right )^{2} - 1\right )} {\rm polylog}\left (3, \cos \left (x\right ) - i \, \sin \left (x\right )\right ) + 16 \, {\left (\cos \left (x\right )^{2} - 1\right )} {\rm polylog}\left (3, -\cos \left (x\right ) + i \, \sin \left (x\right )\right ) + 16 \, {\left (\cos \left (x\right )^{2} - 1\right )} {\rm polylog}\left (3, -\cos \left (x\right ) - i \, \sin \left (x\right )\right ) - 4 \, {\left (x \cos \left (x\right )^{3} + x \cos \left (x\right )\right )} \sin \left (x\right ) - 1}{8 \, {\left (\cos \left (x\right )^{2} - 1\right )}} \]

input
integrate(x^2*cos(x)^2*cot(x)^3,x, algorithm="fricas")
 
output
-1/8*(2*(2*x^2 - 1)*cos(x)^4 - 3*(2*x^2 - 1)*cos(x)^2 - 2*x^2 + 16*(-I*x*c 
os(x)^2 + I*x)*dilog(cos(x) + I*sin(x)) + 16*(I*x*cos(x)^2 - I*x)*dilog(co 
s(x) - I*sin(x)) + 16*(I*x*cos(x)^2 - I*x)*dilog(-cos(x) + I*sin(x)) + 16* 
(-I*x*cos(x)^2 + I*x)*dilog(-cos(x) - I*sin(x)) + 4*((2*x^2 - 1)*cos(x)^2 
- 2*x^2 + 1)*log(cos(x) + I*sin(x) + 1) + 4*((2*x^2 - 1)*cos(x)^2 - 2*x^2 
+ 1)*log(cos(x) - I*sin(x) + 1) - 4*(cos(x)^2 - 1)*log(-1/2*cos(x) + 1/2*I 
*sin(x) + 1/2) - 4*(cos(x)^2 - 1)*log(-1/2*cos(x) - 1/2*I*sin(x) + 1/2) + 
8*(x^2*cos(x)^2 - x^2)*log(-cos(x) + I*sin(x) + 1) + 8*(x^2*cos(x)^2 - x^2 
)*log(-cos(x) - I*sin(x) + 1) + 16*(cos(x)^2 - 1)*polylog(3, cos(x) + I*si 
n(x)) + 16*(cos(x)^2 - 1)*polylog(3, cos(x) - I*sin(x)) + 16*(cos(x)^2 - 1 
)*polylog(3, -cos(x) + I*sin(x)) + 16*(cos(x)^2 - 1)*polylog(3, -cos(x) - 
I*sin(x)) - 4*(x*cos(x)^3 + x*cos(x))*sin(x) - 1)/(cos(x)^2 - 1)
 
3.3.6.6 Sympy [F]

\[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=\int x^{2} \cos ^{2}{\left (x \right )} \cot ^{3}{\left (x \right )}\, dx \]

input
integrate(x**2*cos(x)**2*cot(x)**3,x)
 
output
Integral(x**2*cos(x)**2*cot(x)**3, x)
 
3.3.6.7 Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 2842 vs. \(2 (80) = 160\).

Time = 0.50 (sec) , antiderivative size = 2842, normalized size of antiderivative = 26.81 \[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=\text {Too large to display} \]

input
integrate(x^2*cos(x)^2*cot(x)^3,x, algorithm="maxima")
 
output
-1/48*(3*(2*x^2 + 2*I*x - 1)*cos(6*x)^2 + 4*(16*I*x^3 + 6*x^2 - 42*I*x - 3 
)*cos(4*x)^2 + 2*(32*I*x^3 - 42*x^2 - 48*I*x - 3)*cos(2*x)^2 - 3*(2*x^2 + 
2*I*x - 1)*sin(6*x)^2 + 4*(-16*I*x^3 - 6*x^2 + 42*I*x + 3)*sin(4*x)^2 + 2* 
(-32*I*x^3 + 42*x^2 + 48*I*x + 3)*sin(2*x)^2 + 6*x^2 + 48*(2*(-2*I*x^2 + I 
)*cos(4*x)^2 + 2*(-2*I*x^2 + I)*cos(2*x)^2 + 2*(2*I*x^2 - I)*sin(4*x)^2 + 
2*(2*I*x^2 - I)*sin(2*x)^2 + (2*I*x^2 + (2*I*x^2 - I)*cos(4*x) + 2*(-2*I*x 
^2 + I)*cos(2*x) - (2*x^2 - 1)*sin(4*x) + 2*(2*x^2 - 1)*sin(2*x) - I)*cos( 
6*x) + (-4*I*x^2 + 5*(2*I*x^2 - I)*cos(2*x) - 5*(2*x^2 - 1)*sin(2*x) + 2*I 
)*cos(4*x) + (2*I*x^2 - I)*cos(2*x) - (2*x^2 + (2*x^2 - 1)*cos(4*x) - 2*(2 
*x^2 - 1)*cos(2*x) - (-2*I*x^2 + I)*sin(4*x) - 2*(2*I*x^2 - I)*sin(2*x) - 
1)*sin(6*x) + (4*x^2 + 4*(2*x^2 - 1)*cos(4*x) - 5*(2*x^2 - 1)*cos(2*x) + 5 
*(-2*I*x^2 + I)*sin(2*x) - 2)*sin(4*x) - (2*x^2 - 4*(2*x^2 - 1)*cos(2*x) - 
 1)*sin(2*x))*arctan2(sin(x), cos(x) + 1) + 48*((-I*cos(4*x) + 2*I*cos(2*x 
) + sin(4*x) - 2*sin(2*x) - I)*cos(6*x) + (-5*I*cos(2*x) + 5*sin(2*x) + 2* 
I)*cos(4*x) + 2*I*cos(4*x)^2 + 2*I*cos(2*x)^2 + (cos(4*x) - 2*cos(2*x) + I 
*sin(4*x) - 2*I*sin(2*x) + 1)*sin(6*x) - (4*cos(4*x) - 5*cos(2*x) - 5*I*si 
n(2*x) + 2)*sin(4*x) - 2*I*sin(4*x)^2 - (4*cos(2*x) - 1)*sin(2*x) - 2*I*si 
n(2*x)^2 - I*cos(2*x))*arctan2(sin(x), cos(x) - 1) + 96*(2*I*x^2*cos(4*x)^ 
2 + 2*I*x^2*cos(2*x)^2 - 2*I*x^2*sin(4*x)^2 - 2*I*x^2*sin(2*x)^2 - I*x^2*c 
os(2*x) + (-I*x^2*cos(4*x) + 2*I*x^2*cos(2*x) + x^2*sin(4*x) - 2*x^2*si...
 
3.3.6.8 Giac [F]

\[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=\int { x^{2} \cos \left (x\right )^{2} \cot \left (x\right )^{3} \,d x } \]

input
integrate(x^2*cos(x)^2*cot(x)^3,x, algorithm="giac")
 
output
integrate(x^2*cos(x)^2*cot(x)^3, x)
 
3.3.6.9 Mupad [F(-1)]

Timed out. \[ \int x^2 \cos ^2(x) \cot ^3(x) \, dx=\int x^2\,{\cos \left (x\right )}^2\,{\mathrm {cot}\left (x\right )}^3 \,d x \]

input
int(x^2*cos(x)^2*cot(x)^3,x)
 
output
int(x^2*cos(x)^2*cot(x)^3, x)